package com.itheima.exception;


import com.itheima.pojo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/*全局异常处理器
                1.类上加@RestControllerAdvice
                2.方法上加 @ExceptionHandler(捕获异常的类型)
 */
@RestControllerAdvice
public class AllException {
    @ExceptionHandler(Exception.class)
    public Result exceptionCatch(Exception e){
        e.printStackTrace();
        return Result.error("异常捕获处理");
    }
}
